<?php
/**
 * MongoDig
 *
 * @copyright  Copyright (c) 2010 lanyanguang (http://www.lanyg.com)
 * @license    GNU General Public License 2.0
 * @version    $Id$
 */

/** 启动SESSION */
session_start();

/**	错误报告 */
error_reporting(0);
 
/** 载入config.php */
if(!file_exists('config.php')){
	header('Location:./install.php');
}
require_once 'config.php';

//手动载入class文件函数
function include_class($classname)
{
	global $config;
	require_once $config['site_path'] . '/includes/classes/' . $classname . '.php';
}

//手动载入function文件
function include_function($functionname)
{
	global $config;
	require_once $config['site_path'] . '/includes/functions/' . $functionname . '.php';
}

//手动载入logics文件
function include_logic($logicname)
{
	global $config;
	require_once $config['site_path'] . '/includes/logics/' . $logicname . '.php';
}

//手动载入模板文件
function include_template($templatename)
{
	global $config;
	require_once $config['site_path'] . '/templates/' . $config['template'] . '/' .$templatename . '.php';
}

/** 载入公用函数 */
include_function('common');

/** 连接数据库 */
$conn = connect();

/** 选择数据库 */
$db = $conn->selectDB($config['db_name']);